def solve(citations):
    n = len(citations)
    h = 0
    citations.sort(reverse=True)
    for i in range(n):
        if citations[i] > h:
            h += 1
        else:
            break

    return h


if __name__ == "__main__":
    citations = [3, 0, 6, 1, 5]
    print(solve(citations))
